﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using SLControlLibrary.Resources.Controls.Calendar.OutlookCalendar.BusinessObjects;
using SLControlLibrary.Resources.Controls.Calendar.OutlookCalendar.Common;
using SLControlLibrary.Resources.Controls.Calendar.OutlookCalendar.DataAccess;

namespace SLControlLibrary.Resources.Controls.Calendar.OutlookCalendar
{
    public class ucContent : ContentControl
    {
        #region Dependency Variables
        public static readonly DependencyProperty CurrentDateProperty = DependencyProperty.Register("CurrentDate", typeof(DateTime), typeof(ucContent), new PropertyMetadata(DateTime.Now, new PropertyChangedCallback(CurrentDate_Changed)));
        public static readonly DependencyProperty CurrentDateViewProperty = DependencyProperty.Register("CurrentDateView", typeof(Enumerations.DateView), typeof(ucContent), new PropertyMetadata(Enumerations.DateView.Day, new PropertyChangedCallback(CurrentDateView_Changed)));
        public static readonly DependencyProperty AppointmentsProperty = DependencyProperty.Register("Appointments", typeof(AppointmentList), typeof(ucContent), new PropertyMetadata(null, new PropertyChangedCallback(Appointments_Changed)));
        private static readonly DependencyProperty ContentHeightProperty = DependencyProperty.Register("ContentHeight", typeof(double), typeof(ucContent), new PropertyMetadata(0D, new PropertyChangedCallback(ContentHeight_Changed)));
        public static readonly DependencyProperty TimeSlotsPerHourProperty = DependencyProperty.Register("TimeSlotsPerHour", typeof(SLControlLibrary.Resources.Common.Enumerations.TimeSlotsPerHour), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Enumerations.TimeSlotsPerHour.Fifteen, new PropertyChangedCallback(TimeSlotsPerHour_Changed)));
        public static readonly DependencyProperty HoursPerDayProperty = DependencyProperty.Register("HoursPerDay", typeof(SLControlLibrary.Resources.Common.Enumerations.HoursPerDay), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Enumerations.HoursPerDay.TwentyFour, new PropertyChangedCallback(HoursPerDay_Changed)));
        
        #region Day
        private static readonly DependencyProperty DayAppointmentBackgroundProperty = DependencyProperty.Register("DayAppointmentBackground", typeof(Brush), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Utility.ConvertStringToColor("#10000000"), new PropertyChangedCallback(DayAppointmentBackground_Changed)));
        private static readonly DependencyProperty DayAppointmentForegroundProperty = DependencyProperty.Register("DayAppointmentForeground", typeof(Brush), typeof(ucContent), new PropertyMetadata(new SolidColorBrush(Colors.White), new PropertyChangedCallback(DayAppointmentForeground_Changed)));
        private static readonly DependencyProperty DayAppointmentBorderBrushProperty = DependencyProperty.Register("DayAppointmentBorderBrush", typeof(Brush), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Utility.ConvertStringToColor("#5D8CC9"), new PropertyChangedCallback(DayAppointmentBorderBrush_Changed)));
        private static readonly DependencyProperty DayAppointmentBorderThicknessProperty = DependencyProperty.Register("DayAppointmentBorderThickness", typeof(Thickness), typeof(ucContent), new PropertyMetadata(new Thickness(1), new PropertyChangedCallback(DayAppointmentBorderThickness_Changed)));
        private static readonly DependencyProperty DayContentWorkHoursBackgroundProperty = DependencyProperty.Register("DayContentWorkHoursBackground", typeof(Brush), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Utility.ConvertStringToColor("#D4D7DB"), new PropertyChangedCallback(DayContentWorkHoursBackground_Changed)));
        private static readonly DependencyProperty DayContentNonWorkHoursBackgroundProperty = DependencyProperty.Register("DayContentNonWorkHoursBackground", typeof(Brush), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Utility.ConvertStringToColor("#D4D7DB"), new PropertyChangedCallback(DayContentNonWorkHoursBackground_Changed)));
        private static readonly DependencyProperty DayContentForegroundProperty = DependencyProperty.Register("DayContentForeground", typeof(Brush), typeof(ucContent), new PropertyMetadata(new SolidColorBrush(Colors.White), new PropertyChangedCallback(DayContentForeground_Changed)));
        private static readonly DependencyProperty DayContentBorderBrushProperty = DependencyProperty.Register("DayContentBorderBrush", typeof(Brush), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Utility.ConvertStringToColor("#B0B6BE"), new PropertyChangedCallback(DayContentBorderBrush_Changed)));
        private static readonly DependencyProperty DayContentBorderThicknessProperty = DependencyProperty.Register("DayContentBorderThickness", typeof(Thickness), typeof(ucContent), new PropertyMetadata(new Thickness(1), new PropertyChangedCallback(DayContentBorderThickness_Changed)));
        private static readonly DependencyProperty DayContentHoverBackgroundProperty = DependencyProperty.Register("DayContentHoverBackground", typeof(Brush), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Utility.ConvertStringToColor("#10000000"), new PropertyChangedCallback(DayContentHoverBackground_Changed)));
        private static readonly DependencyProperty DayContentHoverBorderBrushProperty = DependencyProperty.Register("DayContentHoverBorderBrush", typeof(Brush), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Utility.ConvertStringToColor("#5D8CC9"), new PropertyChangedCallback(DayContentHoverBorderBrush_Changed)));
        private static readonly DependencyProperty DayContentHoverBorderThicknessProperty = DependencyProperty.Register("DayContentHoverBorderThickness", typeof(Thickness), typeof(ucContent), new PropertyMetadata(new Thickness(1), new PropertyChangedCallback(DayContentHoverBorderThickness_Changed)));
        #endregion

        #region Week
        private static readonly DependencyProperty WeekContentBackgroundProperty = DependencyProperty.Register("WeekContentBackground", typeof(Brush), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Utility.ConvertStringToColor("#D4D7DB"), new PropertyChangedCallback(WeekContentBackground_Changed)));
        private static readonly DependencyProperty WeekContentBorderBrushProperty = DependencyProperty.Register("WeekContentBorderBrush", typeof(Brush), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Utility.ConvertStringToColor("#B0B6BE"), new PropertyChangedCallback(WeekContentBorderBrush_Changed)));
        private static readonly DependencyProperty WeekContentBorderThicknessProperty = DependencyProperty.Register("WeekContentBorderThickness", typeof(Thickness), typeof(ucContent), new PropertyMetadata(new Thickness(1), new PropertyChangedCallback(WeekContentBorderThickness_Changed)));
        private static readonly DependencyProperty WeekCurrentDateBackgroundProperty = DependencyProperty.Register("WeekCurrentDateBackground", typeof(Brush), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Utility.ConvertStringToColor("#F1A42D"), new PropertyChangedCallback(WeekCurrentDateBackground_Changed)));
        private static readonly DependencyProperty WeekCurrentDateBorderBrushProperty = DependencyProperty.Register("WeekCurrentDateBorderBrush", typeof(Brush), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Utility.ConvertStringToColor("#EE9311"), new PropertyChangedCallback(WeekCurrentDateBorderBrush_Changed)));
        private static readonly DependencyProperty WeekCurrentDateBorderThicknessProperty = DependencyProperty.Register("WeekCurrentDateBorderThickness", typeof(Thickness), typeof(ucContent), new PropertyMetadata(new Thickness(1), new PropertyChangedCallback(WeekCurrentDateBorderThickness_Changed)));
        #endregion

        #region Month
        private static readonly DependencyProperty MonthContentHeaderForegroundProperty = DependencyProperty.Register("MonthContentHeaderForeground", typeof(Brush), typeof(ucContent), new PropertyMetadata(new SolidColorBrush(Colors.White), new PropertyChangedCallback(MonthContentHeaderForeground_Changed)));
        private static readonly DependencyProperty MonthContentHeaderBackgroundProperty = DependencyProperty.Register("MonthContentHeaderBackground", typeof(Brush), typeof(ucContent), new PropertyMetadata(new SolidColorBrush(Colors.LightGray), new PropertyChangedCallback(MonthContentHeaderBackground_Changed)));
        private static readonly DependencyProperty MonthContentHeaderBorderBrushProperty = DependencyProperty.Register("MonthContentHeaderBorderBrush", typeof(Brush), typeof(ucContent), new PropertyMetadata(new SolidColorBrush(Colors.DarkGray), new PropertyChangedCallback(MonthContentHeaderBorderBrush_Changed)));
        private static readonly DependencyProperty MonthContentHeaderBorderThicknessProperty = DependencyProperty.Register("MonthContentHeaderBorderThickness", typeof(Thickness), typeof(ucContent), new PropertyMetadata(new Thickness(1, 1, 1, 2), new PropertyChangedCallback(MonthContentHeaderBorderThickness_Changed)));
        private static readonly DependencyProperty MonthContentBackgroundProperty = DependencyProperty.Register("MonthContentBackground", typeof(Brush), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Utility.ConvertStringToColor("#E6EDF7"), new PropertyChangedCallback(MonthContentBackground_Changed)));
        private static readonly DependencyProperty MonthContentBorderBrushProperty = DependencyProperty.Register("MonthContentBorderBrush", typeof(Brush), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Utility.ConvertStringToColor("#B0B6BE"), new PropertyChangedCallback(MonthContentBorderBrush_Changed)));
        private static readonly DependencyProperty MonthContentBorderThicknessProperty = DependencyProperty.Register("MonthContentBorderThickness", typeof(Thickness), typeof(ucContent), new PropertyMetadata(new Thickness(1), new PropertyChangedCallback(MonthContentBorderThickness_Changed)));
        private static readonly DependencyProperty MonthCurrentDateHeaderForegroundProperty = DependencyProperty.Register("MonthCurrentDateHeaderForeground", typeof(Brush), typeof(ucContent), new PropertyMetadata(new SolidColorBrush(Colors.White), new PropertyChangedCallback(MonthCurrentDateHeaderForeground_Changed)));
        private static readonly DependencyProperty MonthCurrentDateHeaderBackgroundProperty = DependencyProperty.Register("MonthCurrentDateHeaderBackground", typeof(Brush), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Utility.ConvertStringToColor("#D4D7DB"), new PropertyChangedCallback(MonthCurrentDateHeaderBackground_Changed)));
        private static readonly DependencyProperty MonthCurrentDateHeaderBorderBrushProperty = DependencyProperty.Register("MonthCurrentDateHeaderBorderBrush", typeof(Brush), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Utility.ConvertStringToColor("#B0B6BE"), new PropertyChangedCallback(MonthCurrentDateHeaderBorderBrush_Changed)));
        private static readonly DependencyProperty MonthCurrentDateHeaderBorderThicknessProperty = DependencyProperty.Register("MonthCurrentDateHeaderBorderThickness", typeof(Thickness), typeof(ucContent), new PropertyMetadata(new Thickness(1), new PropertyChangedCallback(MonthCurrentDateHeaderBorderThickness_Changed)));
        private static readonly DependencyProperty MonthCurrentDateBackgroundProperty = DependencyProperty.Register("MonthCurrentDateBackground", typeof(Brush), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Utility.ConvertStringToColor("#F1A42D"), new PropertyChangedCallback(MonthCurrentDateBackground_Changed)));
        private static readonly DependencyProperty MonthCurrentDateBorderBrushProperty = DependencyProperty.Register("MonthCurrentDateBorderBrush", typeof(Brush), typeof(ucContent), new PropertyMetadata(SLControlLibrary.Resources.Common.Utility.ConvertStringToColor("#EE9311"), new PropertyChangedCallback(MonthCurrentDateBorderBrush_Changed)));
        private static readonly DependencyProperty MonthCurrentDateBorderThicknessProperty = DependencyProperty.Register("MonthCurrentDateBorderThickness", typeof(Thickness), typeof(ucContent), new PropertyMetadata(new Thickness(1), new PropertyChangedCallback(MonthCurrentDateBorderThickness_Changed)));
        private static readonly DependencyProperty MonthLegendForegroundProperty = DependencyProperty.Register("MonthLegendForeground", typeof(Brush), typeof(ucContent), new PropertyMetadata(new SolidColorBrush(Colors.White), new PropertyChangedCallback(MonthLegendForeground_Changed)));
        private static readonly DependencyProperty MonthLegendBackgroundProperty = DependencyProperty.Register("MonthLegendBackground", typeof(Brush), typeof(ucContent), new PropertyMetadata(new SolidColorBrush(Colors.LightGray), new PropertyChangedCallback(MonthLegendBackground_Changed)));
        private static readonly DependencyProperty MonthLegendBorderBrushProperty = DependencyProperty.Register("MonthLegendBorderBrush", typeof(Brush), typeof(ucContent), new PropertyMetadata(new SolidColorBrush(Colors.Gray), new PropertyChangedCallback(MonthLegendBorderBrush_Changed)));
        private static readonly DependencyProperty MonthLegendBorderThicknessProperty = DependencyProperty.Register("MonthLegendBorderThickness", typeof(Thickness), typeof(ucContent), new PropertyMetadata(new Thickness(1.5), new PropertyChangedCallback(MonthLegendBorderThickness_Changed)));
        #endregion
        #endregion

        #region Dependency Properties
        public DateTime CurrentDate
        {
            get { return (DateTime)this.GetValue(CurrentDateProperty); }
            set { this.SetValue(CurrentDateProperty, value); }
        }
        public Enumerations.DateView CurrentDateView
        {
            get { return (Enumerations.DateView)this.GetValue(CurrentDateViewProperty); }
            set { this.SetValue(CurrentDateViewProperty, value); }
        }
        public double ContentHeight
        {
            get { return (double)this.GetValue(ContentHeightProperty); }
            set { this.SetValue(ContentHeightProperty, value); }
        }
        public AppointmentList Appointments
        {
            get { return (AppointmentList)this.GetValue(AppointmentsProperty); }
            set { this.SetValue(AppointmentsProperty, value); }
        }
        public SLControlLibrary.Resources.Common.Enumerations.TimeSlotsPerHour TimeSlotsPerHour
        {
            get { return (SLControlLibrary.Resources.Common.Enumerations.TimeSlotsPerHour)this.GetValue(TimeSlotsPerHourProperty); }
            set { this.SetValue(TimeSlotsPerHourProperty, value); }
        }
        public SLControlLibrary.Resources.Common.Enumerations.HoursPerDay HoursPerDay
        {
            get { return (SLControlLibrary.Resources.Common.Enumerations.HoursPerDay)this.GetValue(HoursPerDayProperty); }
            set { this.SetValue(HoursPerDayProperty, value); }
        }
        
        #region Day
        public Brush DayAppointmentBackground
        {
            get { return (Brush)this.GetValue(DayAppointmentBackgroundProperty); }
            set { this.SetValue(DayAppointmentBackgroundProperty, value); }
        }
        public Brush DayAppointmentForeground
        {
            get { return (Brush)this.GetValue(DayAppointmentForegroundProperty); }
            set { this.SetValue(DayAppointmentForegroundProperty, value); }
        }
        public Brush DayAppointmentBorderBrush
        {
            get { return (Brush)this.GetValue(DayAppointmentBorderBrushProperty); }
            set { this.SetValue(DayAppointmentBorderBrushProperty, value); }
        }
        public Thickness DayAppointmentBorderThickness
        {
            get { return (Thickness)this.GetValue(DayAppointmentBorderThicknessProperty); }
            set { this.SetValue(DayAppointmentBorderThicknessProperty, value); }
        }
        public Brush DayContentWorkHoursBackground
        {
            get { return (Brush)this.GetValue(DayContentWorkHoursBackgroundProperty); }
            set { this.SetValue(DayContentWorkHoursBackgroundProperty, value); }
        }
        public Brush DayContentNonWorkHoursBackground
        {
            get { return (Brush)this.GetValue(DayContentNonWorkHoursBackgroundProperty); }
            set { this.SetValue(DayContentNonWorkHoursBackgroundProperty, value); }
        }
        public Brush DayContentForeground
        {
            get { return (Brush)this.GetValue(DayContentForegroundProperty); }
            set { this.SetValue(DayContentForegroundProperty, value); }
        }
        public Brush DayContentBorderBrush
        {
            get { return (Brush)this.GetValue(DayContentBorderBrushProperty); }
            set { this.SetValue(DayContentBorderBrushProperty, value); }
        }
        public Thickness DayContentBorderThickness
        {
            get { return (Thickness)this.GetValue(DayContentBorderThicknessProperty); }
            set { this.SetValue(DayContentBorderThicknessProperty, value); }
        }
        public Brush DayContentHoverBackground
        {
            get { return (Brush)this.GetValue(DayContentHoverBackgroundProperty); }
            set { this.SetValue(DayContentHoverBackgroundProperty, value); }
        }
        public Brush DayContentHoverBorderBrush
        {
            get { return (Brush)this.GetValue(DayContentHoverBorderBrushProperty); }
            set { this.SetValue(DayContentHoverBorderBrushProperty, value); }
        }
        public Thickness DayContentHoverBorderThickness
        {
            get { return (Thickness)this.GetValue(DayContentHoverBorderThicknessProperty); }
            set { this.SetValue(DayContentHoverBorderThicknessProperty, value); }
        }
        #endregion

        #region Week
        public Brush WeekContentBackground
        {
            get { return (Brush)this.GetValue(WeekContentBackgroundProperty); }
            set { this.SetValue(WeekContentBackgroundProperty, value); }
        }
        public Brush WeekContentBorderBrush
        {
            get { return (Brush)this.GetValue(WeekContentBorderBrushProperty); }
            set { this.SetValue(WeekContentBorderBrushProperty, value); }
        }
        public Thickness WeekContentBorderThickness
        {
            get { return (Thickness)this.GetValue(WeekContentBorderThicknessProperty); }
            set { this.SetValue(WeekContentBorderThicknessProperty, value); }
        }
        public Brush WeekCurrentDateBackground
        {
            get { return (Brush)this.GetValue(WeekCurrentDateBackgroundProperty); }
            set { this.SetValue(WeekCurrentDateBackgroundProperty, value); }
        }
        public Brush WeekCurrentDateBorderBrush
        {
            get { return (Brush)this.GetValue(WeekCurrentDateBorderBrushProperty); }
            set { this.SetValue(WeekCurrentDateBorderBrushProperty, value); }
        }
        public Thickness WeekCurrentDateBorderThickness
        {
            get { return (Thickness)this.GetValue(WeekCurrentDateBorderThicknessProperty); }
            set { this.SetValue(WeekCurrentDateBorderThicknessProperty, value); }
        }
        #endregion

        #region Month
        public Brush MonthContentHeaderForeground
        {
            get { return (Brush)this.GetValue(MonthContentHeaderForegroundProperty); }
            set { this.SetValue(MonthContentHeaderForegroundProperty, value); }
        }
        public Brush MonthContentHeaderBackground
        {
            get { return (Brush)this.GetValue(MonthContentHeaderBackgroundProperty); }
            set { this.SetValue(MonthContentHeaderBackgroundProperty, value); }
        }
        public Brush MonthContentHeaderBorderBrush
        {
            get { return (Brush)this.GetValue(MonthContentHeaderBorderBrushProperty); }
            set { this.SetValue(MonthContentHeaderBorderBrushProperty, value); }
        }
        public Thickness MonthContentHeaderBorderThickness
        {
            get { return (Thickness)this.GetValue(MonthContentHeaderBorderThicknessProperty); }
            set { this.SetValue(MonthContentHeaderBorderThicknessProperty, value); }
        }
        public Brush MonthContentBackground
        {
            get { return (Brush)this.GetValue(MonthContentBackgroundProperty); }
            set { this.SetValue(MonthContentBackgroundProperty, value); }
        }
        public Brush MonthContentBorderBrush
        {
            get { return (Brush)this.GetValue(MonthContentBorderBrushProperty); }
            set { this.SetValue(MonthContentBorderBrushProperty, value); }
        }
        public Thickness MonthContentBorderThickness
        {
            get { return (Thickness)this.GetValue(MonthContentBorderThicknessProperty); }
            set { this.SetValue(MonthContentBorderThicknessProperty, value); }
        }
        public Brush MonthCurrentDateHeaderForeground
        {
            get { return (Brush)this.GetValue(MonthCurrentDateHeaderForegroundProperty); }
            set { this.SetValue(MonthCurrentDateHeaderForegroundProperty, value); }
        }
        public Brush MonthCurrentDateHeaderBackground
        {
            get { return (Brush)this.GetValue(MonthCurrentDateHeaderBackgroundProperty); }
            set { this.SetValue(MonthCurrentDateHeaderBackgroundProperty, value); }
        }
        public Brush MonthCurrentDateHeaderBorderBrush
        {
            get { return (Brush)this.GetValue(MonthCurrentDateHeaderBorderBrushProperty); }
            set { this.SetValue(MonthCurrentDateHeaderBorderBrushProperty, value); }
        }
        public Thickness MonthCurrentDateHeaderBorderThickness
        {
            get { return (Thickness)this.GetValue(MonthCurrentDateHeaderBorderThicknessProperty); }
            set { this.SetValue(MonthCurrentDateHeaderBorderThicknessProperty, value); }
        }
        public Brush MonthCurrentDateBackground
        {
            get { return (Brush)this.GetValue(MonthCurrentDateBackgroundProperty); }
            set { this.SetValue(MonthCurrentDateBackgroundProperty, value); }
        }
        public Brush MonthCurrentDateBorderBrush
        {
            get { return (Brush)this.GetValue(MonthCurrentDateBorderBrushProperty); }
            set { this.SetValue(MonthCurrentDateBorderBrushProperty, value); }
        }
        public Thickness MonthCurrentDateBorderThickness
        {
            get { return (Thickness)this.GetValue(MonthCurrentDateBorderThicknessProperty); }
            set { this.SetValue(MonthCurrentDateBorderThicknessProperty, value); }
        }
        public Brush MonthLegendForeground
        {
            get { return (Brush)this.GetValue(MonthLegendForegroundProperty); }
            set { this.SetValue(MonthLegendForegroundProperty, value); }
        }
        public Brush MonthLegendBackground
        {
            get { return (Brush)this.GetValue(MonthLegendBackgroundProperty); }
            set { this.SetValue(MonthLegendBackgroundProperty, value); }
        }
        public Brush MonthLegendBorderBrush
        {
            get { return (Brush)this.GetValue(MonthLegendBorderBrushProperty); }
            set { this.SetValue(MonthLegendBorderBrushProperty, value); }
        }
        public Thickness MonthLegendBorderThickness
        {
            get { return (Thickness)this.GetValue(MonthLegendBorderThicknessProperty); }
            set { this.SetValue(MonthLegendBorderThicknessProperty, value); }
        }
        #endregion
        #endregion

        #region Dependency Events
        #region CurrentDate_Changed
        private static void CurrentDate_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnCurrentDate_Changed(e);
        }
        #endregion

        #region CurrentDateView_Changed
        private static void CurrentDateView_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnCurrentDateView_Changed(e);
        }
        #endregion

        #region ContentHeight_Changed
        private static void ContentHeight_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnContentHeight_Changed(e);
        }
        #endregion

        #region Appointments_Changed
        private static void Appointments_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnAppointments_Changed(e);
        }
        #endregion

        #region TimeSlotsPerHour_Changed
        private static void TimeSlotsPerHour_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnTimeSlotsPerHour_Changed(e);
        }
        #endregion

        #region HoursPerDay_Changed
        private static void HoursPerDay_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnHoursPerDay_Changed(e);
        }
        #endregion

        #region Day
        #region DayAppointmentBackground_Changed
        private static void DayAppointmentBackground_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnDayAppointmentBackground_Changed(e);
        }
        #endregion

        #region DayAppointmentForeground_Changed
        private static void DayAppointmentForeground_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnDayAppointmentForeground_Changed(e);
        }
        #endregion

        #region DayAppointmentBorderBrush_Changed
        private static void DayAppointmentBorderBrush_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnDayAppointmentBorderBrush_Changed(e);
        }
        #endregion

        #region DayAppointmentBorderThickness_Changed
        private static void DayAppointmentBorderThickness_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnDayAppointmentBorderThickness_Changed(e);
        }
        #endregion

        #region DayContentWorkHoursBackground_Changed
        private static void DayContentWorkHoursBackground_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnDayContentWorkHoursBackground_Changed(e);
        }
        #endregion

        #region DayContentNonWorkHoursBackground_Changed
        private static void DayContentNonWorkHoursBackground_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnDayContentNonWorkHoursBackground_Changed(e);
        }
        #endregion

        #region DayContentForeground_Changed
        private static void DayContentForeground_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnDayContentForeground_Changed(e);
        }
        #endregion

        #region DayContentBorderBrush_Changed
        private static void DayContentBorderBrush_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnDayContentBorderBrush_Changed(e);
        }
        #endregion

        #region DayContentBorderThickness_Changed
        private static void DayContentBorderThickness_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnDayContentBorderThickness_Changed(e);
        }
        #endregion

        #region DayContentHoverBackground_Changed
        private static void DayContentHoverBackground_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnDayContentHoverBackground_Changed(e);
        }
        #endregion

        #region DayContentHoverBorderBrush_Changed
        private static void DayContentHoverBorderBrush_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnDayContentHoverBorderBrush_Changed(e);
        }
        #endregion        

        #region DayContentHoverBorderThickness_Changed
        private static void DayContentHoverBorderThickness_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnDayContentHoverBorderThickness_Changed(e);
        }
        #endregion
        #endregion

        #region Week
        #region WeekContentBackground_Changed
        private static void WeekContentBackground_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnWeekContentBackground_Changed(e);
        }
        #endregion

        #region WeekContentBorderBrush_Changed
        private static void WeekContentBorderBrush_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnWeekContentBorderBrush_Changed(e);
        }
        #endregion

        #region WeekContentBorderThickness_Changed
        private static void WeekContentBorderThickness_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnWeekContentBorderThickness_Changed(e);
        }
        #endregion

        #region WeekCurrentDateBackground_Changed
        private static void WeekCurrentDateBackground_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnWeekCurrentDateBackground_Changed(e);
        }
        #endregion

        #region WeekCurrentDateBorderBrush_Changed
        private static void WeekCurrentDateBorderBrush_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnWeekCurrentDateBorderBrush_Changed(e);
        }
        #endregion

        #region WeekCurrentDateBorderThickness_Changed
        private static void WeekCurrentDateBorderThickness_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnWeekCurrentDateBorderThickness_Changed(e);
        }
        #endregion
        #endregion

        #region Month
        #region MonthContentHeaderForeground_Changed
        private static void MonthContentHeaderForeground_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthContentHeaderForeground_Changed(e);
        }
        #endregion

        #region MonthContentHeaderBackground_Changed
        private static void MonthContentHeaderBackground_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthContentHeaderBackground_Changed(e);
        }
        #endregion

        #region MonthContentHeaderBorderBrush_Changed
        private static void MonthContentHeaderBorderBrush_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthContentHeaderBorderBrush_Changed(e);
        }
        #endregion

        #region MonthContentHeaderBorderThickness_Changed
        private static void MonthContentHeaderBorderThickness_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthContentHeaderBorderThickness_Changed(e);
        }
        #endregion

        #region MonthContentBackground_Changed
        private static void MonthContentBackground_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthContentBackground_Changed(e);
        }
        #endregion

        #region MonthContentBorderBrush_Changed
        private static void MonthContentBorderBrush_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthContentBorderBrush_Changed(e);
        }
        #endregion

        #region MonthContentBorderThickness_Changed
        private static void MonthContentBorderThickness_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthContentBorderThickness_Changed(e);
        }
        #endregion

        #region MonthCurrentDateHeaderForeground_Changed
        private static void MonthCurrentDateHeaderForeground_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthCurrentDateHeaderForeground_Changed(e);
        }
        #endregion

        #region MonthCurrentDateHeaderBackground_Changed
        private static void MonthCurrentDateHeaderBackground_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthCurrentDateHeaderBackground_Changed(e);
        }
        #endregion

        #region MonthCurrentDateHeaderBorderBrush_Changed
        private static void MonthCurrentDateHeaderBorderBrush_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthCurrentDateHeaderBorderBrush_Changed(e);
        }
        #endregion

        #region MonthCurrentDateHeaderBorderThickness_Changed
        private static void MonthCurrentDateHeaderBorderThickness_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthCurrentDateHeaderBorderThickness_Changed(e);
        }
        #endregion

        #region MonthCurrentDateBackground_Changed
        private static void MonthCurrentDateBackground_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthCurrentDateBackground_Changed(e);
        }
        #endregion

        #region MonthCurrentDateBorderBrush_Changed
        private static void MonthCurrentDateBorderBrush_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthCurrentDateBorderBrush_Changed(e);
        }
        #endregion

        #region MonthCurrentDateBorderThickness_Changed
        private static void MonthCurrentDateBorderThickness_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthCurrentDateBorderThickness_Changed(e);
        }
        #endregion

        #region MonthLegendForeground_Changed
        private static void MonthLegendForeground_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthLegendForeground_Changed(e);
        }
        #endregion

        #region MonthLegendBackground_Changed
        private static void MonthLegendBackground_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthLegendBackground_Changed(e);
        }
        #endregion

        #region MonthLegendBorderBrush_Changed
        private static void MonthLegendBorderBrush_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthLegendBorderBrush_Changed(e);
        }
        #endregion

        #region MonthLegendBorderThickness_Changed
        private static void MonthLegendBorderThickness_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            (sender as ucContent).OnMonthLegendBorderThickness_Changed(e);
        }
        #endregion
        #endregion
        #endregion

        #region Event Variables
        public event EventHandler MonthDay_Clicked;
        public event EventHandler MonthWeek_Clicked;
        public event EventHandler AddAppointment_Clicked;
        #endregion

        #region Constructor
        public ucContent()
        {
            DefaultStyleKey = typeof(ucContent);
        }
        #endregion

        #region Methods
        #region OnApplyTemplate
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            PopulateContent();
        }
        #endregion

        #region PopulateContent
        private void PopulateContent()
        {
            ContentItemProvider Provider = new ContentItemProvider(this);
            ObservableCollection<UIElement> _IList = null;

            switch (CurrentDateView)
            {
                case Enumerations.DateView.Day:
                    ucDayContent _Day = new ucDayContent();
                    _Day.Owner = this;

                    _IList = Provider.GetContent();
                    _Day.ItemsSource = _IList;

                    if (_IList != null && _IList.Count > 0)
                    {
                        foreach (UIElement ele in _IList)
                        {
                            if (ele.GetType() != typeof(Grid))
                                (ele as ucDayContentItem).AddAppointment_Clicked += new EventHandler(Day_AddAppointment_Clicked);
                        }
                    }

                    this.Content = _Day;
                    break;
                case Enumerations.DateView.WorkWeek:
                case Enumerations.DateView.FullWeek:
                    ucWeekContent _Week = new ucWeekContent();
                    _Week.Owner = this;

                    _IList = Provider.GetContent();
                    _Week.ItemsSource = _IList;

                    if (_IList != null && _IList.Count > 0)
                    {
                        foreach (UIElement ele in _IList)
                        {
                            if (ele.GetType() != typeof(Grid) && ele.GetType() == typeof(Border))
                            {
                                foreach (UIElement ele2 in ((ele as Border).Child as StackPanel).Children)
                                {
                                    (ele2 as ucDayContentItem).AddAppointment_Clicked += new EventHandler(Day_AddAppointment_Clicked);
                                    _Week.DayContentWidth = (ele2 as ucDayContentItem).Width;
                                }
                            }
                        }
                    }

                    this.Content = _Week;
                    break;
                case Enumerations.DateView.Month:
                    ucMonthContent _Month = new ucMonthContent(this);
                    _IList = Provider.GetContent();
                    _Month.ItemsSource = _IList;

                    if (_IList != null && _IList.Count > 0)
                    {
                        foreach (UIElement ele in _IList)
                        {
                            if (ele.GetType() != typeof(Grid))
                                (ele as ucMonthContentItem).DayHeader_Clicked += new EventHandler(Month_DayHeader_Clicked);
                        }
                    }

                    _Month.Week_Clicked += new EventHandler(Month_Week_Clicked);

                    this.Content = _Month;
                    break;
                case Enumerations.DateView.Year:
                    ucYearContent _Year = new ucYearContent();
                    _IList = Provider.GetContent();
                    _Year.ItemsSource = _IList;

                    this.Content = _Year;
                    break;
            }
        }
        #endregion

        #region OnCurrentDate_Changed
        protected virtual void OnCurrentDate_Changed(DependencyPropertyChangedEventArgs e)
        {
            CurrentDate = (DateTime)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnCurrentDateView_Changed
        protected virtual void OnCurrentDateView_Changed(DependencyPropertyChangedEventArgs e)
        {
            CurrentDateView = (Enumerations.DateView)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnContentHeight_Changed
        protected virtual void OnContentHeight_Changed(DependencyPropertyChangedEventArgs e)
        {
            ContentHeight = (double)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnAppointments_Changed
        protected virtual void OnAppointments_Changed(DependencyPropertyChangedEventArgs e)
        {
            Appointments = (AppointmentList)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnTimeSlotsPerHour_Changed
        protected virtual void OnTimeSlotsPerHour_Changed(DependencyPropertyChangedEventArgs e)
        {
            TimeSlotsPerHour = (SLControlLibrary.Resources.Common.Enumerations.TimeSlotsPerHour)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnHoursPerDay_Changed
        protected virtual void OnHoursPerDay_Changed(DependencyPropertyChangedEventArgs e)
        {
            HoursPerDay = (SLControlLibrary.Resources.Common.Enumerations.HoursPerDay)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region Day
        #region OnDayAppointmentBackground_Changed
        protected virtual void OnDayAppointmentBackground_Changed(DependencyPropertyChangedEventArgs e)
        {
            DayAppointmentBackground = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnDayAppointmentForeground_Changed
        protected virtual void OnDayAppointmentForeground_Changed(DependencyPropertyChangedEventArgs e)
        {
            DayAppointmentForeground = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnDayAppointmentBorderBrush_Changed
        protected virtual void OnDayAppointmentBorderBrush_Changed(DependencyPropertyChangedEventArgs e)
        {
            DayAppointmentBorderBrush = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnDayAppointmentBorderThickness_Changed
        protected virtual void OnDayAppointmentBorderThickness_Changed(DependencyPropertyChangedEventArgs e)
        {
            DayAppointmentBorderThickness = (Thickness)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnDayContentWorkHoursBackground_Changed
        protected virtual void OnDayContentWorkHoursBackground_Changed(DependencyPropertyChangedEventArgs e)
        {
            DayContentWorkHoursBackground = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnDayContentNonWorkHoursBackground_Changed
        protected virtual void OnDayContentNonWorkHoursBackground_Changed(DependencyPropertyChangedEventArgs e)
        {
            DayContentNonWorkHoursBackground = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnDayContentForeground_Changed
        protected virtual void OnDayContentForeground_Changed(DependencyPropertyChangedEventArgs e)
        {
            DayContentForeground = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnDayContentBorderBrush_Changed
        protected virtual void OnDayContentBorderBrush_Changed(DependencyPropertyChangedEventArgs e)
        {
            DayContentBorderBrush = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnDayContentBorderThickness_Changed
        protected virtual void OnDayContentBorderThickness_Changed(DependencyPropertyChangedEventArgs e)
        {
            DayContentBorderThickness = (Thickness)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnDayContentHoverBackground_Changed
        protected virtual void OnDayContentHoverBackground_Changed(DependencyPropertyChangedEventArgs e)
        {
            DayContentHoverBackground = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnDayContentHoverBorderBrush_Changed
        protected virtual void OnDayContentHoverBorderBrush_Changed(DependencyPropertyChangedEventArgs e)
        {
            DayContentHoverBorderBrush = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnDayContentHoverBorderThickness_Changed
        protected virtual void OnDayContentHoverBorderThickness_Changed(DependencyPropertyChangedEventArgs e)
        {
            DayContentHoverBorderThickness = (Thickness)e.NewValue;
            PopulateContent();
        }
        #endregion
        #endregion

        #region Week
        #region OnWeekContentBackground_Changed
        protected virtual void OnWeekContentBackground_Changed(DependencyPropertyChangedEventArgs e)
        {
            WeekContentBackground = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnWeekContentBorderBrush_Changed
        protected virtual void OnWeekContentBorderBrush_Changed(DependencyPropertyChangedEventArgs e)
        {
            WeekContentBorderBrush = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnWeekContentBorderThickness_Changed
        protected virtual void OnWeekContentBorderThickness_Changed(DependencyPropertyChangedEventArgs e)
        {
            WeekContentBorderThickness = (Thickness)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnWeekCurrentDateBackground_Changed
        protected virtual void OnWeekCurrentDateBackground_Changed(DependencyPropertyChangedEventArgs e)
        {
            WeekCurrentDateBackground = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnWeekCurrentDateBorderBrush_Changed
        protected virtual void OnWeekCurrentDateBorderBrush_Changed(DependencyPropertyChangedEventArgs e)
        {
            WeekCurrentDateBorderBrush = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnWeekCurrentDateBorderThickness_Changed
        protected virtual void OnWeekCurrentDateBorderThickness_Changed(DependencyPropertyChangedEventArgs e)
        {
            WeekCurrentDateBorderThickness = (Thickness)e.NewValue;
            PopulateContent();
        }
        #endregion
        #endregion

        #region Month
        #region OnMonthContentHeaderForeground_Changed
        protected virtual void OnMonthContentHeaderForeground_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthContentHeaderForeground = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnMonthContentHeaderBackground_Changed
        protected virtual void OnMonthContentHeaderBackground_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthContentHeaderBackground = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnMonthContentHeaderBorderBrush_Changed
        protected virtual void OnMonthContentHeaderBorderBrush_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthContentHeaderBorderBrush = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnMonthContentHeaderBorderThickness_Changed
        protected virtual void OnMonthContentHeaderBorderThickness_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthContentHeaderBorderThickness = (Thickness)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnMonthContentBackground_Changed
        protected virtual void OnMonthContentBackground_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthContentBackground = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnMonthContentBorderBrush_Changed
        protected virtual void OnMonthContentBorderBrush_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthContentBorderBrush = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnMonthContentBorderThickness_Changed
        protected virtual void OnMonthContentBorderThickness_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthContentBorderThickness = (Thickness)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnMonthCurrentDateHeaderForeground_Changed
        protected virtual void OnMonthCurrentDateHeaderForeground_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthCurrentDateHeaderForeground = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnMonthCurrentDateHeaderBackground_Changed
        protected virtual void OnMonthCurrentDateHeaderBackground_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthCurrentDateHeaderBackground = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnMonthCurrentDateHeaderBorderBrush_Changed
        protected virtual void OnMonthCurrentDateHeaderBorderBrush_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthCurrentDateHeaderBorderBrush = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnMonthCurrentDateHeaderBorderThickness_Changed
        protected virtual void OnMonthCurrentDateHeaderBorderThickness_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthCurrentDateHeaderBorderThickness = (Thickness)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnMonthCurrentDateBackground_Changed
        protected virtual void OnMonthCurrentDateBackground_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthCurrentDateBackground = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnMonthCurrentDateBorderBrush_Changed
        protected virtual void OnMonthCurrentDateBorderBrush_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthCurrentDateBorderBrush = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnMonthCurrentDateBorderThickness_Changed
        protected virtual void OnMonthCurrentDateBorderThickness_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthCurrentDateBorderThickness = (Thickness)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnMonthLegendForeground_Changed
        protected virtual void OnMonthLegendForeground_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthLegendForeground = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnMonthLegendBackground_Changed
        protected virtual void OnMonthLegendBackground_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthLegendBackground = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnMonthLegendBorderBrush_Changed
        protected virtual void OnMonthLegendBorderBrush_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthLegendBorderBrush = (Brush)e.NewValue;
            PopulateContent();
        }
        #endregion

        #region OnMonthLegendBorderThickness_Changed
        protected virtual void OnMonthLegendBorderThickness_Changed(DependencyPropertyChangedEventArgs e)
        {
            MonthLegendBorderThickness = (Thickness)e.NewValue;
            PopulateContent();
        }
        #endregion
        #endregion
        #endregion    
    
        #region Events
        #region Month_DayHeader_Clicked
        private void Month_DayHeader_Clicked(object sender, EventArgs e)
        {
            if (MonthDay_Clicked != null)
                MonthDay_Clicked(sender, null);
        }
        #endregion

        #region Month_Week_Clicked
        private void Month_Week_Clicked(object sender, EventArgs e)
        {
            if (MonthWeek_Clicked != null)
                MonthWeek_Clicked(sender, null);
        }
        #endregion

        #region Day_AddAppointment_Clicked
        private void Day_AddAppointment_Clicked(object sender, EventArgs e)
        {
            if (AddAppointment_Clicked != null)
                AddAppointment_Clicked(sender, null);
        }
        #endregion
        #endregion
    }
}
